package com.ruoyi.web.controller.aggregation;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.aggregation.dto.PageDTO;
import com.ruoyi.system.domain.aggregation.Video;
import com.ruoyi.system.service.aggregation.IVideoService;

/**
 * 视频Controller
 * 
 * @author ruoyi
 * @date 2025-01-01
 */
@RestController
@RequestMapping("/agg/video")
public class VideoController
{
    @Autowired
    private IVideoService videoService;

    /**
     * 视频分页查询
     */
    @PostMapping("/page")
    public AjaxResult page(@RequestBody PageDTO pageDTO)
    {
        try
        {
            PageHelper.startPage(pageDTO.getPageIndex().intValue(), pageDTO.getPageSize().intValue());
            Video query = new Video();
            List<Video> list = videoService.selectVideoList(query);
            PageInfo<Video> pageInfo = new PageInfo<>(list);
            return AjaxResult.success(pageInfo);
        }
        catch (Exception e)
        {
            return AjaxResult.error(e.getMessage());
        }
    }
}

